package com.kapcb.common.enums;

import com.kapcb.common.result.ResultCode;

/**
 * <a>Title: ResultCodeEnum </a>
 * <a>Author: cb <a>
 * <a>Description: ResultCodeEnum <a>
 *
 * @author cb
 * @version 1.0
 * @date 2024/4/19 10:37
 * @since 1.0
 */
public enum ResultCodeEnum implements ResultCode {

    /**
     * 0 为成功，非 0 失败
     */
    SUCCESS(0, "成功"),

    /**
     * 系统错误 100XXX
     */
    SYSTEM_ERROR(100000, "系统错误"),
    AUTHENTICATION_FAIL(100001, "用户名或密码错误"),
    UNAUTHORIZED(100002, "未经授权"),
    FORBIDDEN(100003, "禁止访问"),
    VALIDATE_CODE_ERROR(100004, "登录验证码错误"),
    VALIDATE_CODE_EXPIRED(100005, "验证码已过期"),
    LOGIN_STATUS_EXPIRED(100006, "登录状态已过期"),
    CAN_NOT_FOUND_LOGIN_INFO(100007, "登录信息不存在"),

    /**
     * 系统业务异常 400XXX
     */
    BUSINESS_ERROR(400000, "系统业务异常"),
    REQUEST_PARAM_VALIDATE_FAIL(400001, "请求参数校验失败"),

    ;

    private final Integer code;

    private final String message;

    ResultCodeEnum(Integer code, String message) {
        this.code = code;
        this.message = message;
    }

    @Override
    public Integer code() {
        return this.code;
    }

    @Override
    public String message() {
        return this.message;
    }
}
